<template>
	<view class="avtive">
		<swiper indicator-dots :circular="true" interval="3000" :autoplay="true">
			<swiper-item v-for="item in lun">
				<image :src="'http://124.93.196.45:10001'+item.advImg" style="width: 100%; height: 100%;"></image>
			</swiper-item>
		</swiper>
		<u-tabs :list="type" :scrollable="false" @click="clicktype" ></u-tabs>
		<view class="a1" v-for="item in list" @click="tonext(item.id)">
			<image :src="'http://124.93.196.45:10001'+item.imgUrl"></image>
			<view class="a2">
				<text>{{item.name}}</text>
				<view class="a3">
					<text>报名人数：{{item.signupNum}}</text>
					<text>点赞数：{{item.likeNum}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				lun:[],
				type:[],
				categoryId:0,
				list:[]
			}
		},
		onLoad() {
			this.getlun()
			this.gettype()
			this.getlist()
		},
		methods: {
			getlun(){
				this.api.get('/prod-api/api/activity/rotation/list').then(res=>{
					this.lun=res.data.rows
				})
			},
			gettype(){
				this.api.get('/prod-api/api/activity/category/list').then(res=>{
					this.type=res.data.data
				})
			},
			clicktype(e){
				this.categoryId=e.id
				this.api.get('/prod-api/api/activity/activity/list?categoryId='+this.categoryId).then(res=>{
					this.list=res.data.rows
				})
			},
			getlist(){
				this.api.get('/prod-api/api/activity/activity/list').then(res=>{
					this.list=res.data.rows
				})
			},
			tonext(id){
				uni.navigateTo({
					url:'/pages/other/active/activedetail/activedetail?id='+id
				})
			}
		}
	}
</script>

<style lang="scss">
.a1{
	margin-top: 20px;
	line-height: 30px;
	image{
		width: 100%;
	}
	.a2{
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
	.a3{
		display: flex;
		justify-content: space-between;
	}
}
</style>
